package com.music.start;

import com.yichen.music.MusicMusicActivity;
import com.yichen.music.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

public class MusicStartAnimation extends Activity {
	ImageView log_1;
	ImageView log_2;
	Animation start_anim;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.start_anim);

		log_1 = (ImageView) findViewById(R.id.log_1);
		log_2 = (ImageView) findViewById(R.id.log_2);

		start_anim = AnimationUtils.loadAnimation(this, R.anim.log_show);
		log_1.startAnimation(start_anim);
		start_anim.setAnimationListener(new AnimationListener() {

			public void onAnimationStart(Animation animation) {
				// TODO Auto-generated method stub
				log_1.setVisibility(View.VISIBLE);
				// log_2.setVisibility(View.VISIBLE);
			}

			public void onAnimationRepeat(Animation animation) {
				// TODO Auto-generated method stub

			}

			public void onAnimationEnd(Animation animation) {
				// TODO Auto-generated method stub
				Animation start_anim_1 = AnimationUtils.loadAnimation(
						MusicStartAnimation.this, R.anim.log_show);
				log_2.setVisibility(View.VISIBLE);
				log_2.startAnimation(start_anim_1);
				start_anim_1.setAnimationListener(new AnimationListener() {

					public void onAnimationStart(Animation animation) {
						// TODO Auto-generated method stub

					}

					public void onAnimationRepeat(Animation animation) {
						// TODO Auto-generated method stub

					}

					public void onAnimationEnd(Animation animation) {
						// TODO Auto-generated method stub
						Intent intent = new Intent();
						intent.setClass(MusicStartAnimation.this,
								MusicMusicActivity.class);
						MusicStartAnimation.this.startActivity(intent);
						MusicStartAnimation.this.finish();

					}
				});
				// log_2.startAnimation(start_anim);

			}
		});

	}

}
